﻿@model Siser.Web.Models.Fabricante

@{
    ViewBag.Title = "Registrar fabricante";
}
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

@*Validación de usuario, para que no se pueda acceder a la página sin estar logueado *@
@if (@User.Identity.Name == "")
{
    Layout = null;
    <div style="width:800px; font-size:2em; height:500px; text-align:center; margin-top:100px" class="division">
    @Html.ActionLink("Ingrese como usuario válido...", "InicioSesion", "Cuenta")
    </div>
}
else
{ 
<div class="espacio">&nbsp</div>   
<script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.autotab-1.1b.js")" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#Nombre').autotab({format: 'custom', pattern: '[<>]' });
        $('#Direccion').autotab({ format: 'custom', pattern: '[<>]' });
        $('#Telefono').autotab({format: 'custom', pattern: '[<>]' });

    });
	</script>

    using (Html.BeginForm())
    {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Registrar fabricante</legend>
        <div>&nbsp</div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Nombre)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Nombre, new { maxlength = 30, size = 30, onpaste = "return false" })
            @Html.ValidationMessageFor(model => model.Nombre)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Direccion,"Dirección")
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Direccion, new { maxlength = 30, size = 30, onpaste = "return false" })
            @Html.ValidationMessageFor(model => model.Direccion)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Telefono, "Teléfono")
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Telefono, new { maxlength = 20, size = 30, onpaste = "return false" })
            @Html.ValidationMessageFor(model => model.Telefono)
        </div>
        <div>&nbsp</div>
        <p>
            <input type="submit" value="Crear" />
        </p>
    </fieldset>
    }

<div class="division">
    @Html.ActionLink("Volver", "Index")
</div>
}